function animateS(obj, json, fn) {
    clearInterval(obj.timer);
    obj.timer = setInterval(function () {
        var flag = true;
        for (var k in json) {
            if (k === "opacity") {
                var leader = getAttr(obj, k) * 1000;
                var target = json[k] * 1000;
                var step = (target - leader) / 10;
                step = step > 0 ? Math.ceil(step) : Math.floor(step);
                leader += step;
                obj.style[k] = leader / 1000;
                if (Math.abs(target - leader) >= Math.abs(step)) {
                    flag = false
                } else {
                    obj.style[k] = json[k];
                    flag = true;
                }
            } else if (k === "zIndex") {
                obj.style[k] = json[k];
            } else if (k === "scrollToY") {
                var leader = scroll().top;
                var target = json[k];
                var step = (target - leader) / 10;
                step = step > 0 ? Math.ceil(step) : Math.floor(step);
                window.scrollTo(scroll().left,leader);
            } else {
                var leader = parseInt(getAttr(obj, k)) || 0;
                var target = json[k];
                var step = (target - leader) / 10;
                step = step > 0 ? Math.ceil(step) : Math.floor(step);
                leader += step;
                obj.style[k] = leader + "px";
            }
            if (Math.abs(target - leader) >= Math.abs(step)) {
                flag = false;
            } else {
                obj.style[k] = json[k] + "px";
                flag = true;
            }
        }
        if (flag) {
            clearInterval(obj.timer);
            if (typeof fn == "function") {
                fn();
            }
        }
    }, 15);
}

function scroll(){
    return {
        top: pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0,
        left: pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0
    }
}
function getAttr(obj, attr) {
    return getComputedStyle ? getComputedStyle(obj, null)[attr] : obj.currentStyle[attr];
}